package com.geotmt.billingcenter.modules.cost.service.impl;

import com.geotmt.billingcenter.common.entry.CostRuleEntry;
import com.geotmt.billingcenter.modules.cost.mapper.CostRuleMapper;
import com.geotmt.billingcenter.modules.cost.service.CostRuleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @Description 成本 consume
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/3/19 19:56
 * @Version     v1
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class CostRuleServiceImpl implements CostRuleService {

    private static final Logger logger = LoggerFactory.getLogger(CostRuleServiceImpl.class);

    @Resource
    private CostRuleMapper costRuleMapper;

    @Override
    public Integer addRule(CostRuleEntry costRule) {
        logger.info("成本 addRule Service");
        costRuleMapper.addRule(costRule);
        return costRule.getId();
    }
}
